package com.matt.system.service.impl;

import java.util.List;

import org.hibernate.criterion.DetachedCriteria;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.matt.system.dao.UserDao;
import com.matt.system.domain.TSysuser;
import com.matt.system.service.UserService;
@Service
public class UserServiceImpl implements UserService {
	
	@Autowired
	private UserDao userDao;

	@Override
	public void addUser(TSysuser user) {

	}

	@Override
	public void delUser(TSysuser user) {
		// TODO Auto-generated method stub

	}

	@Override
	public List<TSysuser> findAll() {
		// TODO Auto-generated method stub
		return this.userDao.findAll();
	}

	@Override
	public TSysuser findByCode(String code){
		// TODO Auto-generated method stub
		return this.userDao.findByCode(code);
	}

	@Override
	public TSysuser login(String name, String password) {
		TSysuser user = this.userDao.findByNameAndPassword(name, password);
		return user;
	}

	@Override
	public void updateUser(TSysuser user) {
		// TODO Auto-generated method stub

	}

	@Override
	public List<TSysuser> findAllByPage(int pageNow, int pageSize) {
		return userDao.findAllByPage(pageNow, pageSize);
	}

	@Override
	public long getRows() {
		return userDao.getRows();
	}

	public List<TSysuser> findPageByCriteria(final int pageNow,
			final int pageSize, DetachedCriteria detachedCriteria) {
		return userDao.findPageByCriteria(pageNow, pageSize,detachedCriteria);
	}

	@Override
	public long getCountByCriteria(DetachedCriteria detachedCriteria) {
		return userDao.getCountByCriteria(detachedCriteria);
	}

}
